const express = require("express");
const app = express();

//引入数据库连接文件
require("./db")

//引入外部路由
const addAdminRoute=require("./routes/addAdmin");
const adminListRoute=require("./routes/adminList");
const deleteAdminRoute = require("./routes/deleteAdmin")
const loginRoute = require("./routes/login")

//处理post请求体的中间件,会在req上添加一个body属性,值是请求体参数
app.use(express.urlencoded());
app.use(express.json());
//使用路由
app.use(addAdminRoute)
app.use(adminListRoute)
app.use(deleteAdminRoute)
app.use(loginRoute)


app.listen("8000", () => {
  console.log("服务器启动成功 http://127.0.0.1:8000");
})